/*     */ package com.qmsk.business.keyword.keyWord.controller;
/*     */ 
/*     */ import com.qmsk.business.keyword.keyWord.dao.KeyWordDAO;
/*     */ import com.qmsk.business.keyword.keyWord.service.KeyWordService;
/*     */ import com.utils.basic.MapUtils;
/*     */ import com.utils.gson.in.ParserDataSetJson;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/keyWord"})
/*     */ public class KeyWordController
/*     */ {
/*  28 */   private static final Logger logger = Logger.getLogger(KeyWordController.class);
/*     */ 
/*     */   @Autowired
/*     */   private KeyWordDAO dao;
/*     */ 
/*     */   @Autowired
/*     */   private KeyWordService service;
/*     */ 
/*     */   @RequestMapping(value={"find/keyWordList/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOptShopId(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize) {
/*  38 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  40 */       Map params = new HashMap();
/*  41 */       MapUtils.addToMap(params, "status", 
/*  42 */         RequestUtils.getString(request, "status"));
/*  43 */       MapUtils.addToMap(params, "id", 
/*  44 */         RequestUtils.getString(request, "id"));
/*  45 */       MapUtils.addPercentToMap(params, "title", 
/*  46 */         RequestUtils.getString(request, "title"));
/*  47 */       MapUtils.addPercentToMap(params, "keyWord", 
/*  48 */         RequestUtils.getString(request, "key"));
/*  49 */       MapUtils.addToMap(params, "replyId", 
/*  50 */         RequestUtils.getString(request, "replyId"));
/*  51 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAll(params, nPageIdx, nPageSize);
/*  52 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/*  54 */       logger.error(e);
/*  55 */       ResponseUtils.setErrorMsgResponse(
/*  56 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  73 */     String sGsonInData = request.getParameter("data");
/*     */     try
/*     */     {
/*  76 */       ParserDataSetJson p = ParserDataSetJson.fromString(sGsonInData);
/*  77 */       if ((p == null) || (!(p.isExistsInsertRows()))) {
/*  78 */         ResponseUtils.setErrorMsgResponse(
/*  79 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/*  80 */           response);
/*  81 */         return;
/*     */       }
/*  83 */       Integer id = Integer.valueOf(this.dao.applyUpdates(p));
/*     */ 
/*  94 */       if ((id != null) && (id.intValue() > 0))
/*     */       {
/*  96 */         ResponseUtils.setSuccessResponse(response);
/*  97 */         return; }
/*  98 */       ResponseUtils.setErrorMsgResponse(
/*  99 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 100 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 103 */       logger.error(e);
/* 104 */       ResponseUtils.setErrorMsgResponse(
/* 105 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 106 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 122 */       Long[] arParams = RequestUtils.getIdLongSplit(request);
/* 123 */       int nResult = this.dao.deleteParams(arParams);
/* 124 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 125 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 126 */         response);
/*     */     } catch (Exception e) {
/* 128 */       logger.error(e);
/* 129 */       ResponseUtils.setErrorMsgResponse(
/* 130 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 131 */         response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void edit(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 146 */     String sGsonInData = request.getParameter("data");
/*     */     try
/*     */     {
/* 149 */       ParserDataSetJson p = ParserDataSetJson.fromString(sGsonInData);
/* 150 */       if ((p == null) || (!(p.isExistsUpdateRows()))) {
/* 151 */         ResponseUtils.setErrorMsgResponse(
/* 152 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/* 153 */           response);
/* 154 */         return;
/*     */       }
/*     */ 
/* 157 */       int nResult = this.dao.applyUpdates(p);
/*     */ 
/* 168 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 169 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 170 */         response);
/*     */     } catch (Exception e) {
/* 172 */       logger.error(e);
/* 173 */       ResponseUtils.setErrorMsgResponse(
/* 174 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 175 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.keyword.keyWord.controller.KeyWordController
 * JD-Core Version:    0.5.3
 */